home *** CD-ROM | disk | FTP | other *** search
/ Biodiversity of Illinois 2: Woodland Habitats / Biodiversity of Illinois 2 - Woodland Habitats.iso / mac / casts / PDFxtraBehaviors.cst / 00018_Script_PDF_LaunchViewer < prev    next >
Text File  |  2006-07-11  |  5KB  |  119 lines

  1. -- Launch the specified application to view PDFs
  2.  
  3. Property pEvent, pLaunchScheme, pPath
  4.  
  5. on doLaunch me
  6.   case pLaunchScheme of
  7.     "Default installed PDF viewer": 
  8.       err = PDF_LaunchViewer([#launchScheme: #default])
  9.     "Installed Acrobat only":
  10.       err = PDF_LaunchViewer([#launchScheme: #Acrobat])
  11.     "Reader on CD-ROM":
  12.       if pPath <> "" then -- use specified path
  13.         err = PDF_LaunchViewer([#launchScheme: #CDROM, #path: pPath])
  14.       else
  15.         err = PDF_LaunchViewer([#launchScheme: #CDROM])
  16.       end if
  17.     "Custom path specified":
  18.       if pPath <> "" then -- use specified path
  19.         err = PDF_LaunchViewer([#launchScheme: #custom, #path: pPath])
  20.       else
  21.         err = PDF_LaunchViewer([#launchScheme: #default]) -- use default launch if no path is specified
  22.       end if
  23.     otherwise:
  24.       err = PDF_LaunchViewer([#launchScheme: #default])
  25.       
  26.   end case
  27.   
  28.   
  29. end doLaunch
  30.  
  31. on mouseUp me
  32.   if (pEvent = #mouseUp) then doLaunch(me)
  33. end mouseUp
  34.  
  35. on mouseDown me
  36.   if (pEvent = #mouseDown) then doLaunch(me)
  37. end mouseDown
  38.  
  39. on prepareFrame me
  40.   if (pEvent = #prepareFrame) then doLaunch(me)
  41. end prepareFrame
  42.  
  43. -- standard behavior stuff --
  44. on getPropertyDescriptionList me
  45.   set defaultValues = GetDefaultValues (me)
  46.   
  47.   set pdfSpriteList = getProp (defaultValues, #spriteList)
  48.   set defSprite     = getProp (defaultValues, #defaultSprite)
  49.   
  50.   set p_list = [:]
  51.   addprop p_list, #pEvent, [ #comment: "Event", #format:#symbol, #range:[ #prepareFrame,#mouseUp, #mouseDown], #default:#prepareFrame]
  52.   addprop p_list, #pLaunchScheme, [ #comment: "Which PDF application to launch:", #format: #string, #range: [ "Default installed PDF viewer", "Installed Acrobat only", "Reader on CD-ROM", "Custom path specified" ], #default: "Default installed PDF viewer" ]
  53.   addprop p_list, #pPath, [ #comment: "Application path (required for Custom launch):", #format:#string, #default:"" ]
  54.   
  55.   return p_list
  56. end
  57.  
  58. on getBehaviorDescription
  59.   
  60.   tmp = "Launches a specified version of Adobe Acrobat or Reader.  Use this Behavior only if you are distributing Acrobat or Reader with your application. Note that only Acrobat Reader can be launched from CD-ROM." 
  61.   tmp = tmp &RETURN& "When using this Behavior the Application property (in the Global Options section of the PDF Xtra Member Options dialog box) must be set to ANY." 
  62.   tmp = tmp &RETURN&RETURN& "--- PARAMETERS ---" 
  63.   tmp = tmp &RETURN& " - Event: the event on which to launch Acrobat/Reader." &RETURN& "The preferred approach is to launch Acrobat/Reader on the prepareFrame event of either the first frame of the movie or a few frames before the first PDF document sprite appears." 
  64.   tmp = tmp &RETURN& " - LaunchScheme: #Default attempts to launch Adobe Reader or Reader Active-X" 
  65.   tmp = tmp &RETURN& "      #Acrobat attempts to launch the full version of Acrobat -- an error is returned if it is not installed." 
  66.   tmp = tmp &RETURN& "      #CDROM attempts to launch Adobe Reader from the Reader folder on CD drive;" 
  67.   tmp = tmp &RETURN& "      if a path, relative to the root of the CD, is specified PDF Xtra will look for the Reader at that location." 
  68.   tmp = tmp &RETURN& "      #Custom attempts to launch Adobe Reader from the path specified in the Path parameter." 
  69.   tmp = tmp &RETURN& "Please see the User Manual for more information." 
  70.   tmp = tmp &RETURN&RETURN& "Free to use and abuse. (c)2002 - 2005, Integration New Media, Inc."
  71.   return tmp
  72. end
  73.  
  74. on getBehaviorTooltip
  75.   return "Launches a specified version" & RETURN& "of Adobe Acrobat or Reader." &RETURN& "All platforms." 
  76. end
  77.  
  78. -- utils --
  79.  
  80. on GetDefaultValues me
  81.   if the currentSpriteNum then
  82.     set spriteList = GetSpriteList (me #PDF)
  83.     if count (spriteList) then
  84.       set defaultSprite = getAt (spriteList, 1)
  85.     else
  86.       set defaultSprite = 0
  87.     end if
  88.     
  89.     return [#spriteList: spriteList, #defaultSprite: defaultSprite]
  90.     
  91.   else -- the currentSpriteNum = 0
  92.     -- Director is merely recompiling this script: return dummy values
  93.     return [#spriteList: [1], #defaultSprite: 1]
  94.   end if
  95. end 
  96.  
  97.  
  98. on GetSpriteList me, memberType
  99.   -- return list of sprites of type memberType in current frame
  100.   global version
  101.   if (char 1 of version = 6) then
  102.     set maxSprite = 120
  103.   else
  104.     set maxSprite = the lastChannel
  105.   end if
  106.   
  107.   set aList=[]
  108.   
  109.   repeat with i = 1 to maxSprite
  110.     set spriteMember = the member of sprite i
  111.     if (the type of spriteMember = memberType) then
  112.       append (aList, i)
  113.     end if
  114.   end repeat
  115.   
  116.   return aList
  117. end GetSpriteList
  118.  
  119.